# -*- coding: utf-8 -*-
# @ Time   :  2021/4/14 15:19
# @ Author : Redtree
# @ File :  date_encoder 
# @ Desc :

import json
import datetime


class DateEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, datetime.datetime):
            return obj.strftime("%Y-%m-%d %H:%M:%S")
        else:
            return json.JSONEncoder.default(self, obj)
